import { userModules } from '../../../../../stores/userModulsStore'
export const useMyEventHttp = () => {
  const getUserEventData = ref([])
  const isEventList = ref(false)
  const isUserEventShow = ref(true)
  const { userLoginData } = userModules()

  // 用户事件展示
  const handleGetEvent = () => {
    if (userLoginData.value.id) {
      isEventList.value = !isEventList.value
    } else {
      ElMessage.error('请登录')
    }
  }

  // 用户事件获取
  const getUserEvent = async () => {
    const a = String(userLoginData.value.id)
    const res = await getAllEventHttp('', '', a, '')
    if (res.data.code === 0) {
      getUserEventData.value = res.data.data
    }
  }
  onMounted(() => {
    getUserEvent()
  })

  return {
    getUserEventData,
    isEventList,
    isUserEventShow,
    handleGetEvent
  }
}
